<?php

require_once dirname(__FILE__) . '/../bootstrap.unit.php';

class ForageCreationTest extends ForageUnitTestCase
{
  public function testCreateCreatesAForageInstance()
  {
    $forage = Forage::create('solr:127.0.0.1:8080');
    $this->assertType('Forage', $forage);
  }

  public function testCreatedForageHasCorrectEngineSolr()
  {
    $forage = Forage::create('solr:127.0.0.1:8080');
    $this->assertInstanceOf($forage->engine, 'ForageEngine');
    $this->assertInstanceOf($forage->engine, 'ForageSolrEngine');
  }

  /**
   * @expectedException ForageEngineException
   */
  public function testCreateFailsWithBadDSN()
  {
    $forage = Forage::create('invalid:blah');
  }
}
